package cn.edu.sdjzu.xg.eagle.util;

import cn.edu.sdjzu.xg.eagle.entity.Pagination;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;

import java.util.List;

public class ControllerHelper {
    public static List<Condition> getConditions(JSONObject req_jsonObj) {
        JSONArray conditionList_jsonArray = req_jsonObj.getJSONArray("conditionList");
        List<Condition> conditionList = null;
        if (conditionList_jsonArray != null) {
            conditionList = conditionList_jsonArray.toJavaList(Condition.class);
        }
        return conditionList;
    }

    public static Pagination getPagination(JSONObject req_jsonObj) {
        JSONObject pagination_jsonObj = req_jsonObj.getJSONObject("pagination");
        Pagination pagination = null;
        if (pagination_jsonObj != null) {
            pagination = pagination_jsonObj.toJavaObject(Pagination.class);
        }
        return pagination;
    }
}
